//
//  NEDFormSubItem.h
//  NEDFormView_Example
//
//  Created by 000 on 2022/1/7.
//  Copyright © 2022 000. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "NEDFormContentLayout.h"

NS_ASSUME_NONNULL_BEGIN

typedef NS_ENUM(NSInteger, NEDFormContentShowType) {
    /// 文本
    NEDFormContentShowType_Title    = 1,
    /// 开关
    NEDFormContentShowType_Switch,
    /// 图标
    NEDFormContentShowType_Image,
    /// 自定义视图
    NEDFormContentShowType_Custom,
};
UIKIT_EXTERN NSString * NEDFormContentShowTypeDes(NEDFormContentShowType showType);

/// 内容所属的位置
typedef NS_ENUM(NSInteger, NEDFormContentShowPosition) {
    NEDFormContentShowPosition_Left,
    NEDFormContentShowPosition_Center,
    NEDFormContentShowPosition_Right,
};

@class NEDFormContentItem;
@class NEDFormItem;

typedef void(^_Nullable NEDFormContentViewBlock)(__kindof UIView * contentView, NEDFormItem * sectionItem, NEDFormContentItem * contentItem);
typedef void(^_Nullable NEDFormContentItemBlock)(NEDFormItem * sectionItem, NEDFormContentItem * contentItem);
typedef UIView *_Nonnull(^_Nullable NEDFormContentInitViewBlock)(NEDFormItem * sectionItem, NEDFormContentItem * contentItem);
typedef BOOL(^_Nullable NEDFormContentAvailableBlock)(NEDFormItem * sectionItem, NEDFormContentItem * contentItem);

/// 左右两侧的显示信息
@interface NEDFormContentItem : NSObject

/// 内容类型
@property (assign, nonatomic, readonly) NEDFormContentShowType showType;
/// 所属位置
@property (assign, nonatomic, readonly) NEDFormContentShowPosition position;
/// 布局信息
@property (retain, nonatomic, readonly) NEDFormContentLayout * layout;

/// MARK: - 关联的数据，数据变化，自动刷新对应视图

/// 内容文本 标题之类
@property (copy, nonatomic) NSString * contentTitle;
/// 图片的名字 或者 链接
@property (copy, nonatomic) NSString * contentImageURL;
/// switch 开关
@property (assign, nonatomic) BOOL contentSwitchIsOn;
/// 其他关联的消息类型
@property (retain, nonatomic) id contentLinkDataInfo;

/// MARK: - 回调信息

/// 创建视图
@property (copy, nonatomic) NEDFormContentInitViewBlock initViewBlock;
/// 检验是否数值有效
@property (copy, nonatomic) NEDFormContentAvailableBlock availableBlock;
/// 获取其绑定的视图
@property (copy, nonatomic) UIView * _Nullable(^getViewBlock)(void);


/// 设置 对应 showType 的图片 文本 开关视图的样式
@property (copy, nonatomic) NEDFormContentViewBlock styleBlock;
/// 显示刷新视图数据
@property (copy, nonatomic) NEDFormContentViewBlock showViewBlock;
/// 点击
@property (copy, nonatomic) NEDFormContentViewBlock clickBlock;


/// MARK: - Method

- (instancetype)init NS_UNAVAILABLE;
+ (instancetype)new NS_UNAVAILABLE;

- (instancetype)initWithType:(NEDFormContentShowType)showType position:(NEDFormContentShowPosition)position belongFormSectionItem:(NEDFormItem *)sectionItem;

- (BOOL)isAvailable;

@end

NS_ASSUME_NONNULL_END
